$(function () {
	$('#document_publication_date').datepicker({ dateFormat: 'dd.mm.yy' });
	

	$('#sort_by_dropdownId').change(function() {
		window.location = $(this).find('option:selected').val();
	});
 
    $('.documentlist').hoverIntent({
        over: makeTall,
        timeout: 0,
        interval: 200,
        out: makeSmall
        }
    );
		
	//When page loads...
    $(".tab_content").hide(); //Hide all content
    $("ul.tab li:first").addClass("active").show(); //Activate first tab
    $(".tab_content:first").show(); //Show first tab content

    //On Click Event
    $("ul.tab li").click(function() {

        $("ul.tab li").removeClass("active"); //Remove any "active" class
        $(this).addClass("active"); //Add "active" class to selected tab
        $(".tab_content").hide(); //Hide all tab content

        var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
        $(activeTab).fadeIn(); //Fade in the active ID content
        return false;
    });
    $('.sidebar_tooltip_box').hide();
    
    $('.newest_uploads_document').hoverIntent({
        over: showTooltip,
        timeout: 100,
        interval: 300,
        out: hideTooltip
        }
    );
    
});

function showTooltip() {
        $(this).find('div[id^="sidebar_tooltip_box_Id_"]').show();
}
function hideTooltip() {
        $(this).find('.sidebar_tooltip_box').hide();
}

function makeTall() {
        $(this).find('div[id^="document_preview_"]').show();
        $(this).find('div[id="divcon"]').animate({height:'130px'}, 300);
}
function makeSmall() {
        $(this).find('.prediv').hide();
        $(this).find('div[id="divcon"]').animate({height:'60px'}, 300);
}
